<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

    <ui:define name="body">
	<h:form id="MovieTableForm">
      <rich:dataTable 	value="#{moviesStateContainer.list}"
      					var="movie"
      					id="movieTable"
      					sortMode="single"
      					rendered="#{not empty moviesStateContainer.list}"
      					onRowMouseOver="this.style.backgroundColor='#B1C7B4'"
      					onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'"
      					rows="20" 
      					reRender="ds"
      					headerClass="smallHeadLine">
      
      	<rich:column style="width:50px">
      		<f:facet name="header">
      			<h:outputText value="#{messages['hu.bme.tesslo.hmdb.no']}" />
      		</f:facet>
      			<h:outputText value="#{movie.id}" />
      		<f:facet name="footer">
      			<h:outputText value="#{messages['hu.bme.tesslo.hmdb.savenew']}" rendered="#{identity.loggedIn}" />
      		</f:facet>
      	</rich:column>
      <rich:column sortBy="#{movie.title}"
      				filterBy="#{movie.title}"
      				filterEvent="onkeyup"
      				filterValue="#{MoviePageBean.titleFilter}">
      		<f:facet name="header">
      			<h:outputText value="#{messages['hu.bme.tesslo.hmdb.title']}" />
      		</f:facet>
      			<h:outputText value="#{movie.title}" />
      		<f:facet name="footer">
      			<h:inputText value="#{HomePageBean.newMovie.title}" rendered="#{identity.loggedIn}" />
      		</f:facet>
      	</rich:column>
      	<rich:column sortBy="#{movie.genre}"
      				filterBy="#{movie.genre}"
      				filterEvent="onkeyup"
      				filterValue="#{MoviePageBean.genreFilter}">
      		<f:facet name="header">
      			<h:outputText value="#{messages['hu.bme.tesslo.hmdb.genre']}"/>
      		</f:facet>
      			<h:outputText value="#{movie.genre}" />
      		<f:facet name="footer">
      			<h:inputText value="#{HomePageBean.newMovie.genre}" rendered="#{identity.loggedIn}"/>
      		</f:facet>
      	</rich:column>
      	<rich:column sortBy="#{movie.year}"
      				filterBy="#{movie.year}"
      				filterEvent="onkeyup">
      		<f:facet name="header">
      			<h:outputText value="#{messages['hu.bme.tesslo.hmdb.year']}" />
      		</f:facet>
      			<h:outputText value="#{movie.year}" />
      		<f:facet name="footer">
      			<h:inputText value="#{HomePageBean.newMovie.year}" rendered="#{identity.loggedIn}" />
      		</f:facet>
      	</rich:column>
      	<rich:column  sortBy="#{movie.imdbRating}" style="width:100px"
      				filterBy="#{movie.imdbRating}"
      				filterEvent="onkeyup">
      		<f:facet name="header">
      			<h:outputText value="#{messages['hu.bme.tesslo.hmdb.rating']}" />
      		</f:facet>
      			<h:outputText value="#{movie.imdbRating}" />
      		<f:facet name="footer">
      			<rich:inputNumberSlider value="#{HomePageBean.newMovie.imdbRating}" minValue="0" maxValue="10"  showInput="false"
            enableManualInput="false" rendered="#{identity.loggedIn}"/>
      		</f:facet>
      	</rich:column>
      	<rich:column>
      		<f:facet name="header">
      			<h:outputText value="#{messages['hu.bme.tesslo.hmdb.details']}" />
      		</f:facet>
      			<h:commandButton value="#{messages['hu.bme.tesslo.hmdb.details']}" action="#{HomePageBean.changeSelectedMovie(movie)}" styleClass="myButton" rendered="#{identity.loggedIn}"/>
      			<h:commandButton value="#{messages['hu.bme.tesslo.hmdb.details']}" action="login" styleClass="myButton" rendered="#{not identity.loggedIn}"/>
      		<f:facet name="footer">
      			<h:commandButton value="Save" title="Save" image="/img/save.png" action="#{HomePageBean.saveNewMovie()}" styleClass="myButton" rendered="#{identity.loggedIn}"/>
      		</f:facet>
      	</rich:column>
      	 <f:facet name="footer">
                <rich:datascroller id="ds" renderIfSinglePage="false"/>
         </f:facet>
      </rich:dataTable>
</h:form>
    </ui:define>
</ui:composition>
